This has code for visualising what is happening with a multiple regression. To run this yourself out of the Markdown, you’ll need to install the package plotly, but the html should work fine for you even if you don’t.

Tutorial 10 dataset visualisation

Q3 model (no interaction)

First, let’s visualise the model from Q3 where willingness is predicted by both extroversion and openness, but no interaction effect between the two predictors is included in the model.

Q5 model (interaction)

Let’s visualise the model from Q5 where willingness is predicted by both extroversion and openness, now with an interaction effect included. Note that for this dataset, the coefficient of the interaction term is tiny (i.e., 0.001983) which is why this doesn’t look very different from the previous plot – there really isn’t much of an interaction at all.